import req from '../utils/https'

export function getIndex() {
    return req.get("http://yapi.shangyuninfo.com/mock/131/weChat/applet/course/index/data/new")
}

//  获取轮播图
export function getImglist() {
    return req.get(`/api/weChat/applet/course/banner/list`)
}

//  获取课程
export function postClass(type, pageNum = 1, pageSize = 10) {
    let params = new URLSearchParams()
    params.append("type", type)
    params.append("pageNum", pageNum)
    params.append("pageSize", pageSize)
    return req.post(`/api/weChat/applet/course/list/type`, params)
}

//  获取课程详情
export function getClasscourse(courseId) {
    return req.get(`/api/pc/course/detail/${courseId}`)
}

//  获取友情链接
export function postFriend(dictType = 'blogroll', pageNum = "1", pageSize = "10", orderByColumn = "dictSort", isAsc = "asc") {
    let params = new URLSearchParams()
    params.append("dictType", dictType)
    params.append("pageNum", pageNum)
    params.append("pageSize", pageSize)
    params.append("orderByColumn", orderByColumn)
    params.append("isAsc", isAsc)
    return req.post(`/api/system/dict/data/list/open`, params)
}

//获取文章列表
export function getArticleList() {
    return req.post('/api/weChat/applet/article/list', {})
}

//获取文章详情
export function getArticleText(articleId) {
    return req.get(`/api/weChat/applet/article/detail/${articleId}`)
}

//获取专题列表
export function postprojectList() {
    // let params = new URLSearchParams()
    // params.append("enable",enable)
    return req.post(`/api/weChat/applet/subject/list`, {"enable": 1})
}
